#include "tcpsvr.hpp"

int main(int argc, char* argv[])
{
    if(argc != 3)
    {
        printf("./cli [ip] [port]\n");
        return 0;
    }

    std::string ip = argv[1];
    uint16_t port = atoi(argv[2]);

    TcpSvr ts;
    if(!ts.CreateSock())
    {
        return 0;
    }

    if(!ts.Connect(ip, port))
    {
        return 0;
    }

    while(1)
    {
        Data data;
        data.a = 1;
        data.b = 2;
        ts.Send(&data); //1+1
        ts.Send(&data); //1+1

        std::string buf;
        ts.Recv(buf);
        printf("server send say:%s\n", buf.c_str());
    }
    ts.Close();
    return 0;
}
